package com.bdc.user.action;

import com.bdc.user.dao.IUserDao;
import com.google.inject.Inject;
import com.opensymphony.xwork2.Action;
import org.apache.log4j.Logger;

/**
 * User: shawn
 * Date: 2011-8-28
 * Time: 22:27:13
 */
public class CheckMailAction {

    private Logger logger = Logger.getLogger(RegisterAction.class.getName());

    @Inject
    private IUserDao userDao;

    private String mail;
    private String result;

    public String checkMail() {
        logger.debug("checkMail action start");
        boolean isExist = userDao.getUserInfo(mail) != null;
        result = isExist ? "true" : "false";
        return Action.SUCCESS;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }
}
